package week3;
import java.util.Scanner;
/**
 * Created by dell on 2017/3/10.
 */
class Cashcard {
    private String number;
    private int balance;
    private int bonus;
    Cashcard(String number, int balance, int bonus){
        this.number = number;
        this.balance = balance;
        this.bonus = bonus;
    }
    void store(int money) {
        if(money > 0){
            this.balance += money;
            if(money >= 1000) {
                this.bonus ++;
            }

        }
        else {
            System.out.println("存储必须为正！");
        }
    }

    int getBalance(){
        return balance;
    }
    int getBonus(){
        return bonus;
    }
    String getNumber(){
        return number;
    }
}


public class CashApp3 {
    public static void main(String[] args){
        Scanner scanner = new Scanner(System.in);
        Cashcard card = new Cashcard("A001", 500, 0);
        System.out.print("请输入存储值：");
        card.store(scanner.nextInt());
        System.out.printf("明细 (%s, %d, %d)%n",card.getNumber(),card.getBalance(),card.getBonus());
    }
}
